torque.bars['bottom.files.bbar'] = new Ext.Toolbar({
    items: [
        new Ext.Button({
            text: 'Recheck Files',
            iconCls: 'icon-generic-refresh',
            handler: function() {
                Ext.Msg.confirm('Torrent Files', 'Are you sure you want to recheck the files... this will take a while.', function(btn){
                        if (btn == 'yes'){
                            var conn = new Ext.data.Connection();
                            conn.request({
                                url: '/api/json/recheck/'+torque.torrents.activeHash,
                                method: 'GET',
                                success: function(responseObject) {
                                    var obj = Ext.decode(responseObject.responseText);
                                    console.dir(obj);
                                    if(obj.success !== undefined) {
                                        torque.panel('torrents').getStore().reload();
                                    }else if(obj.error !== undefined) {
                                        Ext.Msg.alert('Error',obj.error);
                                    }                                 
                                },
                                failure: function() {
                                    Ext.Msg.alert('Status', 'Unable to show history at this time. Please try again later.');
                                }
                            });
                        }
                    });
            }
        })
    ]
});
